package com.lthlearn.mapper;

import com.lthlearn.pojo.Collect;
import com.lthlearn.pojo.Travel;
import com.lthlearn.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author: 2942733239@qq.com
 * @date: 2024/11/4 11:12
 * @description: com.lthlearn.mapper
 * @version: 1.0
 */
public interface UserMapper {

    /**
     * 根据邮箱查询用户
     *
     * @param email
     * @return
     */
    @Select("select user_id,username,email,pwd,power from tb_user where email=#{email}")
    User findByEmail(String email);

    /**
     * 根据 id 查询用户
     *
     * @param userId
     * @return
     */
    @Select("select user_id, username, email, pwd, power from tb_user where user_id = #{userId}")
    User findById(Integer userId);

    /**
     * 分步查询第一步：根据 id 查询用户信息
     *
     * @param userId
     * @return
     */
    User findByUserIdStepOne(Integer userId);

    /**
     * 根据用户 id 查找当前用户收藏的所有景点 id 集合，
     * 再去景点表中查找所有景点信息
     * by：collection
     *
     * @param userId
     * @return
     */
    User findCollectByUserIdAndPlaceIds(Integer userId);

}
